<!DOCTYPE HTML>
<html>
  <head>
    <title>Park</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta http-equiv="x-dns-prefetch-control" content="on">
    <meta name="format-detection" content="telephone=no">
  </head>
  <body>
    <div id="parking_space"></div>
    <div id="plate"></div>
    <div>扣费方：商米科技</div>
    <div id="duration"></div>
    <div>扣费标准：1元/10分钟</div>
    <div id="fee"></div>
  </body>
</html>
<script>
  function urlParam(name) {
  var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
  if(!results || results.length <= 1) {
    return "";
  }
  return results[1] || 0;
};

var no = urlParam('no')
var plate_no = decodeURI(urlParam('plate'))
var beginTime = urlParam('begin')

var space = document.getElementById('parking_space')
var plate = document.getElementById('plate')
var duration = document.getElementById('duration')
var fee = document.getElementById('fee')

space.innerText = '停车位：' + no
plate.innerText = '车牌号：' + plate_no

function countDown() {
  var now = (new Date()).getTime()
  var diff = now - beginTime
  var second = diff / 1000
  var sec = parseInt(second % 60)
  var min = parseInt(second / 60)
  duration.innerText = '已停时长：' + min + ' : ' + sec
  var f = parseInt(second / 600)
  fee.innerText = '扣费：' + f + '元'
  setTimeout(countDown, 1000)
}

countDown()

</script>
